package com.ultrapower.bean;

import com.ultrapower.buffer.Buffer;
import com.ultrapower.buffer.FixedBuffer;

public class JvmInfoBean {
	private final byte version;
	private String jvmVersion;
	private String gcTypeName;

	public JvmInfoBean(byte[] serializedJvmInfoBo) {
		final Buffer buffer = new FixedBuffer(serializedJvmInfoBo);
		this.version = buffer.readByte();
		int version = this.version & 0xFF;
		switch (version) {
		case 0:
			this.jvmVersion = buffer.readPrefixedString();
			this.gcTypeName = buffer.readPrefixedString();
			break;
		default:
			this.jvmVersion = "";
			this.gcTypeName = "";
			break;
		}
	}

	@Override
	public String toString() {
		return "JvmInfoBean [version=" + version + ", jvmVersion=" + jvmVersion + ", gcTypeName=" + gcTypeName + "]";
	}
	
	
}
